/* 全局样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* 全局容器样式 */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 职场助手主容器 */
.workplace-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

/* 职场助手头部 */
.workplace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #1e88e5;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.workplace-header .logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.workplace-header .logo-icon {
  font-size: 2rem;
}

.workplace-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.workplace-header .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.workplace-header .user-name {
  font-weight: 500;
}

.workplace-header .logout-button {
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s;
}

.workplace-header .logout-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* 分类标签 */
.category-tabs {
  display: flex;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 1rem;
  gap: 0.5rem;
}

.category-tab {
  padding: 0.75rem 1.5rem;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: #666;
  transition: all 0.3s;
}

.category-tab:hover {
  color: #1e88e5;
}

.category-tab.active {
  color: #1e88e5;
  border-bottom-color: #1e88e5;
  background-color: white;
}

/* 职场助手内容区域 */
.workplace-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 聊天消息区域 */
.chat-messages {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: #fafbfc;
}

/* 消息样式 */
.message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-message {
  align-self: flex-end;
}

.assistant-message {
  align-self: flex-start;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #666;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.sender-name {
  font-weight: 500;
}

.message-time {
  font-size: 0.8rem;
  color: #999;
}

.message-content {
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.user-message .message-content {
  background-color: #1e88e5;
  color: white;
  border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
  background-color: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

.message-content p {
  margin: 0 0 0.5rem 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* 快捷回复区域 */
.quick-responses {
  width: 300px;
  padding: 1.5rem;
  background-color: white;
  border-left: 1px solid #e0e0e0;
  overflow-y: auto;
}

.quick-response-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.quick-response-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quick-response-btn {
  padding: 0.75rem 1rem;
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  text-align: left;
  transition: all 0.3s;
}

.quick-response-btn:hover {
  background-color: #e3f2fd;
  border-color: #1e88e5;
  color: #1e88e5;
}

/* 输入区域 */
.chat-input-container {
  padding: 1rem 2rem;
  background-color: white;
  border-top: 1px solid #e0e0e0;
}

.input-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.chat-input:focus {
  border-color: #1e88e5;
  box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.1);
}

.send-button {
  padding: 0.75rem 1.5rem;
  background-color: #1e88e5;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.send-button:hover:not(:disabled) {
  background-color: #1976d2;
}

.send-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.input-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.action-hint {
  font-size: 0.8rem;
  color: #999;
}

/* 无消息提示 */
.no-messages {
  text-align: center;
  color: #999;
  padding: 2rem;
  font-size: 0.95rem;
}

/* 加载状态 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1e88e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 打字指示器 */
.typing-indicator {
  display: flex;
  gap: 0.25rem;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.5;
  } 
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .workplace-header {
    padding: 1rem;
  }
  
  .workplace-header h1 {
    font-size: 1.25rem;
  }
  
  .category-tabs {
    overflow-x: auto;
    padding: 0 0.5rem;
  }
  
  .category-tab {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
  
  .workplace-content {
    flex-direction: column;
  }
  
  .quick-responses {
    width: 100%;
    border-left: none;
    border-top: 1px solid #e0e0e0;
    max-height: 200px;
  }
  
  .message {
    max-width: 95%;
  }
  
  .chat-messages {
    padding: 1rem;
  }
  
  .chat-input-container {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .workplace-header .logo-icon {
    font-size: 1.5rem;
  }
  
  .workplace-header h1 {
    font-size: 1.1rem;
  }
  
  .workplace-header .user-info {
    gap: 0.5rem;
  }
  
  .user-name {
    display: none;
  }
  
  .logout-button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* 头部样式 */
.app-header {
  margin-bottom: 2rem;
  text-align: center;
}

.logo-container {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.react:hover {
  filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  a:nth-of-type(2) .logo {
    animation: logo-spin infinite 20s linear;
  }
}

/* 连接状态样式 */
.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 1rem;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  font-size: 0.9rem;
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-indicator.connected {
  background-color: #4caf50;
  animation: pulse 2s infinite;
}

.status-indicator.disconnected {
  background-color: #f44336;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

.status-text {
  color: #333;
}

.mode-indicator {
  font-weight: 500;
  color: #666;
}

.mode-switch {
  padding: 0.3rem 0.8rem;
  background-color: #646cff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.3s;
}

.mode-switch:hover {
  background-color: #535bf2;
}

/* 主内容区域 */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* 聊天容器样式 */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  background-color: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 聊天头部样式 */
.chat-header {
  padding: 1rem 2rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.chat-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

/* 用户信息样式 */
.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-weight: 500;
  color: #333;
}

.logout-button {
  padding: 0.5rem 1rem;
  background-color: #f5f5f5;
  color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-button:hover {
  background-color: #e0e0e0;
  color: #333;
}

/* 认证页面样式 */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: #f8f9fa;
}

.auth-page-content {
  width: 100%;
  max-width: 400px;
}

.auth-container {
  width: 100%;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.auth-header {
  padding: 2rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.auth-header h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: #666;
  font-size: 1rem;
}

.auth-form {
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.auth-button {
  width: 100%;
  padding: 0.75rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-button:hover:not(:disabled) {
  background-color: #0056b3;
}

.auth-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.auth-footer {
  padding: 1.5rem 2rem;
  text-align: center;
  border-top: 1px solid #f0f0f0;
  color: #666;
}

.auth-switch-button {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  font-weight: 500;
  padding: 0;
  margin-left: 0.25rem;
}

.auth-switch-button:hover {
  text-decoration: underline;
}

.auth-message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.auth-error {
  color: #d32f2f;
  background-color: #ffebee;
  border-left: 4px solid #d32f2f;
}

.auth-success {
  color: #2e7d32;
  background-color: #e8f5e9;
  border-left: 4px solid #4caf50;
}

/* 加载状态样式 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 聊天消息区域样式 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 消息样式 */
.message {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  max-width: 80%;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.assistant-message {
  align-self: flex-start;
}

/* 头像样式 */
.avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.user-message .avatar {
  background-color: #007bff;
  color: white;
}

.assistant-message .avatar {
  background-color: #f0f0f0;
  color: #333;
}

/* 消息内容样式 */
.message-content {
  background-color: #f0f0f0;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  word-wrap: break-word;
  position: relative;
}

.user-message .message-content {
  background-color: #007bff;
  color: white;
}

.assistant-message .message-content {
  background-color: #f0f0f0;
  color: #333;
}

.message-content p {
  margin: 0;
  line-height: 1.5;
}

/* 输入区域样式 */
.chat-input-container {
  padding: 1.5rem 2rem;
  background-color: white;
  border-top: 1px solid #e0e0e0;
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  min-height: 2.5rem;
  max-height: 10rem;
  overflow-y: auto;
}

.chat-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.send-button {
  padding: 0.75rem 1.5rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.send-button:hover:not(:disabled) {
  background-color: #0056b3;
}

.send-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.input-actions {
  margin-top: 0.5rem;
  padding-left: 1rem;
}

.action-hint {
  font-size: 0.8rem;
  color: #888;
}

/* 打字指示器样式 */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: #888;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    box-shadow: none;
  }
  
  .chat-header {
    padding: 0.75rem 1rem;
  }
  
  .chat-messages {
    padding: 1rem;
    gap: 1rem;
  }
  
  .message {
    max-width: 90%;
  }
  
  .chat-input-container {
    padding: 1rem;
  }
  
  .avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }
  
  .app-container {
    padding: 1rem;
  }
  
  .connection-status {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
